
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__PUBLIC__/static/css/style.css">
    <link rel="icon" href="__PUBLIC__/static/image/code.png">
</head>
<body class="body">

<form class="layui-form" action="" method="post" id="addform">

	<div class="layui-form-item">
        <label class="layui-form-label">父级节点</label>
        <div class="layui-input-inline">
            <select name="pid" lay-verify="required" lay-search="">
            	<option value="0">顶级分类</option>
                {foreach $typename as $key=>$vo}
            	<option value="{$vo.id}" {$typepid == $vo.id ? 'selected' : ''} {$vo._level == 4 ? 'disabled="disabled"' : ''} {$vo._level == 4 ? 'disabled="disabled"' : ''} {$info.id == $vo.id ? 'disabled="disabled"' : ''}>{$vo._name|raw}</option>
                {/foreach}
            </select>
        </div>
	</div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">节点名称</label>
            <div class="layui-input-inline">
                <input type="type" name="title" lay-verify="title" autocomplete="off" placeholder="请输入节点名称" class="layui-input" value="{$info.title}">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">节点地址</label>
            <div class="layui-input-inline">
                <input type="type" name="name" lay-verify="" autocomplete="off" placeholder="请输入节点地址" class="layui-input" value="{$info.name}">
            </div>
        </div>
    </div>

<!--     <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">其它规则</label>
            <div class="layui-input-inline">
                <input type="type" name="condition" lay-verify="" autocomplete="off" placeholder="请输入节点地址" class="layui-input" value="{$info.condition}">
            </div>
        </div>
    </div> -->

    <div class="layui-form-item">
        <label class="layui-form-label">节点图标</label>
        <div class="layui-input-inline">
            <input type="type" name="icon" lay-verify="" autocomplete="off" placeholder="请输入节点图标" class="layui-input" value="{$info.icon}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <input type="type" name="sorts" lay-verify="" autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$info.sorts}">
        </div>
    </div>    

    <div class="layui-form-item">
	  	<div class="layui-inline">
	    <label class="layui-form-label">状态</label>
	    <div class="layui-input-inline">
	      <input type="radio" name="status" value="1" title="正常" {$info.status == 1 ? 'checked=""' : ''}>
	      <input type="radio" name="status" value="0" title="禁止" {$info.status == 0 ? 'checked=""' : ''}>
	    </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否菜单</label>
	    <div class="layui-input-inline">
	      <input type="radio" name="ismenu" value="1" title="显示" {$info.ismenu == 1 ? 'checked=""' : ''}>
	      <input type="radio" name="ismenu" value="0" title="不显示" {$info.ismenu == 0 ? 'checked=""' : ''}>
	    </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
{notempty name="$info"}
  <input type="hidden" name="id" value="{$info.id}">
{/notempty}  
</form>
<!-- 通用-970*90 -->
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script src="__ADMIN__/js/comm.js" charset="utf-8"></script>
<script>
        layui.use(['form', 'upload','admin'], function(){
        var $ = layui.jquery
            ,layer = layui.layer
            ,form = layui.form
            ,upload = layui.upload
            ,admin = layui.admin;

        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 2){
                    return '标题至少得2个字符啊';
                }
            }
        });

        //监听指定开关
        form.on('submit(demo1)', function(data){
            admin.action('{:url('admin/AuthRule/edit')}',$("#addform").serialize());
            return false;
        });

    });
</script>
</body>
</html>